<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">

<head th:include="include :: header"></head>
<style>
	#brand .closeBtn,#columnPictureImg{
		display: inline-block;
		margin-right: 25px;
		margin-bottom: 25px;
		position:relative;
	}
	.iconcloseImg{
		position:absolute;
		top: -10px;
		right: -10px;
	}
	.popup{
		width: 600px;
		position: fixed;
		top: 50%;
		left: 50%;
		transform: translate(-50%,-50%);
		z-index: 100;
		display: none;
	}
	.popup img:nth-child(1){
		width: 100%;
	}
	.closen{
		position: fixed;
		top: 0;
		right: 0;
		z-index: 101;
		cursor: pointer;
	}
	.shade{
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background: rgba(0,0,0,.5);
		z-index: 99;
		display: none;
	}
</style>
<body class="gray-bg">
<div class="shade"></div>
<div class="popup"></div>
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="signupForm">

						<input type="hidden" id="examVal" th:value="${examRegistrationDO.examType}">
						<input type="hidden" id="id" name="id" th:value="${examRegistrationDO.id}">
						<input type="hidden" name="registeredTrainees" th:value="${examRegistrationDO.registeredTrainees}">

						<div class="form-group">
							<label class="col-sm-3 control-label">培训类型：</label>
							<div class="col-sm-8">
								<select name="examType" id="examInput" class="form-control">
<!--									<option value="0" th:selected="${examRegistrationDO.examType=='0'}">1+X幼儿照护职业技能等级证书师资及考评员</option>-->
<!--									<option value="1" th:selected="${examRegistrationDO.examType=='1'}">1+X幼儿照护职业技能等级证书高级师资及考评员</option>-->
<!--									<option value="2" th:selected="${examRegistrationDO.examType=='2'}">1+X幼儿照护职业技能等级证书考评员到期复审换证</option>-->
<!--									<option value="3" th:selected="${examRegistrationDO.examType=='3'}">1+X产后恢复职业技能等级证书师资及考评员</option>-->
<!--									<option value="4" th:selected="${examRegistrationDO.examType=='4'}">1+X幼儿照护、产后恢复职业技能等级证书考务技术与督导员</option>-->
<!--									<option value="5" th:selected="${examRegistrationDO.examType=='5'}">高职护理——江西国培</option>-->
<!--									<option value="6" th:selected="${examRegistrationDO.examType=='6'}">中职幼儿保育——江西国培</option>-->
<!--									<option value="7" th:selected="${examRegistrationDO.examType=='7'}">教学能力竞赛研修班</option>-->
<!--									<option value="8" th:selected="${examRegistrationDO.examType=='8'}">金砖大赛-第二届婴幼儿照护训练营</option>-->
<!--									<option value="9" th:selected="${examRegistrationDO.examType=='9'}">金砖大赛-首届产后恢复训练营</option>-->
<!--									<option value="10" th:selected="${examRegistrationDO.examType=='10'}">2024年国培省培班</option>-->
								</select>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">培训标题：</label>
							<div class="col-sm-8">
								<input id="noticeTitle" name="noticeTitle" placeholder="请输入" class="form-control" type="text" th:value="${examRegistrationDO.noticeTitle}">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">文件号：</label>
							<div class="col-sm-8">
								<input name="fileNumber" placeholder="请输入文件号" class="form-control" type="text" th:value="${examRegistrationDO.fileNumber}">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">培训总人数：</label>
							<div class="col-sm-8">
								<input id="totalTrainees" name="totalTrainees" placeholder="请输入培训总数" class="form-control" type="text" th:value="${examRegistrationDO.totalTrainees}">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">报名时间：</label>
							<div class="col-sm-8">

								<div class="layui-inline" id="times">
									<div class="layui-input-inline">
										<input type="text" name="registrationStartDate" id="registrationStartDate" class="layui-input" th:value="${examRegistrationDO.registrationStartDate}" placeholder="开始日期">
									</div>
									<div class="layui-input-inline"> ~ </div>
									<div class="layui-input-inline">
										<input type="text" name="registrationEndDate" id="registrationEndDate" class="layui-input" th:value="${examRegistrationDO.registrationEndDate}" placeholder="结束日期">
									</div>
								</div>

							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">班会时间：</label>
							<div class="col-sm-8">
								<input id="classMeetingDate" name="classMeetingDate" th:value="${examRegistrationDO.classMeetingDate}" class="form-control" type="text" placeholder="班会时间">

							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">培训时间：</label>
							<div class="col-sm-8">

								<div class="layui-inline" id="timesOut">
									<div class="layui-input-inline">
										<input type="text" name="trainingStartDate" id="trainingStartDate" class="layui-input" th:value="${examRegistrationDO.trainingStartDate}" placeholder="开始日期">
									</div>
									<div class="layui-input-inline"> ~ </div>
									<div class="layui-input-inline">
										<input type="text" name="trainingEndDate" id="trainingEndDate" class="layui-input" th:value="${examRegistrationDO.trainingEndDate}" placeholder="结束日期">
									</div>
								</div>

							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">结业时间：</label>
							<div class="col-sm-8">
								<input id="graduationDate" name="graduationDate" class="form-control" th:value="${examRegistrationDO.graduationDate}" placeholder="结业时间" type="text">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">班主任：</label>
							<div class="col-sm-8">
								<input name="classTeacher" class="form-control" placeholder="班主任" type="text" th:value="${examRegistrationDO.classTeacher}">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">联系方式：</label>
							<div class="col-sm-8">
								<input name="teacherPhone" class="form-control" placeholder="联系方式" maxlength="11" type="text" th:value="${examRegistrationDO.teacherPhone}">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">培训形式：</label>

							<div class="col-sm-8">
								<select name="trainingForm" id="trainingForm" class="form-control">
									<option value="">请选择</option>
									<option value="1">线上培训</option>
									<option value="2">线下培训</option>
								</select>
								<input type="hidden" id="training" th:value="${examRegistrationDO.trainingForm}">
							</div>
						</div>

						<div class="form-group" id="address" style="display: none">
							<label class="col-sm-3 control-label">培训地址：</label>
							<div class="col-sm-8">
								<div id="l-map"></div>
								<div id="r-result">
									<input type="text" id="suggestId" size="20" type="hidden" class="form-control" />
									<input type="text" id="trainingAddress" class="form-control" name="trainingAddress" th:value="${examRegistrationDO.trainingAddress}">
								</div>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">培训形式说明：</label>
							<div class="col-sm-8">
								<input id="trainingExplain" name="trainingExplain" type="hidden" th:value="${examRegistrationDO.trainingExplain}">
								<div class="ibox-content no-padding">
									<div id="trainingForm_sn" class="brandCharacteristics editor"></div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">培训介绍：</label>
							<div class="col-sm-8">
								<input id="examIntro" name="examIntro" type="hidden" th:value="${examRegistrationDO.examIntro}">
								<div class="ibox-content no-padding">
									<div id="content_sn" class="brandCharacteristics editor"></div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-3 control-label">栏目图：</label>
							<div class="col-sm-8">

								<div id="columnPictureImg" >
									<div class="closeBtn" th:if="${examRegistrationDO.columnPicture != ''}">
										<img onclick="scale(this)" class="upImg" th:src="${examRegistrationDO.columnPicture}" width="95"/>
										<span class="iconcloseImg"><img src="../../../img/close.png"></span>
									</div>
								</div>

								<input id="columnPicture" name="columnPicture" type="hidden" th:value="${examRegistrationDO.columnPicture}">
								<button type="button" class="btn btn-success" id="columnPictureAdd" style="margin-top: 10px;">
									<i class="fa fa-cloud"></i>上传栏目图
								</button>

							</div>
						</div>


						<div class="form-group">
							<label class="col-sm-3 control-label">群二维码：</label>
							<div class="col-sm-8">
								<div id="QRcodeImg">
									<div class="closeBtn">
										<img onclick="scale(this)" class="qrcodeImgUpImg" width="95"/>
										<span class="iconcloseImg"><img src="../../../img/close.png"></span>
									</div>
								</div>
								<input id="qrCode" name="qrCode" type="hidden" th:value="${examRegistrationDO.qrCode}">
								<button type="button" class="btn btn-success" id="QRcodeAdd" style="margin-top: 10px;">
									<i class="fa fa-cloud"></i>上传二维码
								</button>
							</div>
						</div>


						<div class="form-group">
							<label class="col-sm-3 control-label">附件：</label>
							<div class="col-sm-8">

								<div id="brand">
									<div class="closeBtn">
										<a target="_blank">
											<img class="upImg" src="../../../img/pdf.png" width="95"/>
										</a>
										<span class="iconclose"><img src="../../../img/close.png"></span>
									</div>
								</div>

								<input type="hidden" id="fileList" th:value="${list}">
								<input id="trainingPdf" name="trainingPdf" type="hidden"  th:value="${examRegistrationDO.trainingPdf}">
								<input id="fileName" name="fileName" type="hidden" th:value="${examRegistrationDO.fileName}">

								<button type="button" class="btn btn-success" id="btnAdd" style="margin-top: 10px;">
									<i class="fa fa-cloud"></i>上传附件
								</button>

							</div>
						</div>

						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">
								<button class="btn btn-primary" onclick="update()">提交</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/webJs/jzweb/examRegistration/edit.js"></script>
<script type="text/javascript" src="https://api.map.baidu.com/getscript?v=3.0&ak=AqBSmvbrl4d9faHZVgMEKBwLSi8Qw491&services=&t=20230317105246"></script>

<script>

	var map = new BMap.Map("l-map");

	var ac = new BMap.Autocomplete(    //建立一个自动完成的对象
			{"input" : "suggestId"
				,"location" : map
			});

	ac.addEventListener("onhighlight", function(e) {  //鼠标放在下拉列表上的事件
		var str = "";
		var _value = e.fromitem.value;
		var value = "";
		if (e.fromitem.index > -1) {
			value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
		}
		str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;

		value = "";
		if (e.toitem.index > -1) {
			_value = e.toitem.value;
			value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
		}

	});

	var myValue;
	ac.addEventListener("onconfirm", function(e) {    //鼠标点击下拉列表后的事件
		var _value = e.item.value;
		myValue = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
	});

	$("#trainingAddress").focus(function (){
		$(this).attr('type','hidden');
		$("#suggestId").attr('type','text')
	})

	function scale(that){ //图标放大
		let src = $(that).attr('src');
		$(".shade").show()
		$(".popup").show().html('<img style="width: 70%" src="'+ src +'"> <img class="closen" src="../../../img/close.png" width="30" height="30">')

		$(".closen").click(function (){
			$(".shade").hide()
			$(".popup").hide().html('')
		})
	}
	var prefix = "/common/sysDict";
	function sysDictList() {
		let examVal = $("#examVal").val()
		$.ajax({
			url: prefix + "/list",
			cache: true,
			type: "get",
			data: {
				type: 'examType'
			},// 你的formid
			async: false,
			success: function (r) {
				console.log(r)
				r.forEach(item => {
					if(item.value==examVal){
						$('#examInput').append(`
                            <option value="${item.value}" selected="selected">
                                ${item.name}
                            </option>`)
					}else{
						$('#examInput').append(`
                            <option value="${item.value}">
                                ${item.name}
                            </option>`)
					}
				});
			}
		});
	}

	$().ready(function () {
		sysDictList()
	});
</script>

</body>

</html>